// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

frappe.query_reports["Balance Sheet CN"] = $.extend({}, erpnext.financial_statements);

erpnext.utils.add_dimensions("Balance Sheet CN", 10);

frappe.query_reports["Balance Sheet CN"]["filters"].push({
	fieldname: "selected_view",
	label: __("Select View"),
	fieldtype: "Select",
	options: [
		{ value: "Report", label: __("Report View") },
		{ value: "Growth", label: __("Growth View") },
	],
	default: "Report",
	reqd: 1,
});
frappe.query_reports["Balance Sheet CN"]["filters"].push({
	fieldname: "accumulated_values",
	label: __("Accumulated Values"),
	fieldtype: "Check",
	default: 1,
});
frappe.query_reports["Balance Sheet CN"]["filters"].push({
	fieldname: "include_default_book_entries",
	label: __("Include Default FB Entries"),
	fieldtype: "Check",
	default: 1,
});
frappe.query_reports["Balance Sheet CN"]["filters"].push({
	fieldname: "fiscal_year_opening",
	label: __("Fiscal Year Opening"),
	fieldtype: "Check",
	default: 0,
	description: __("Show opening balances of the current fiscal year"),
});
// 调整模板筛选器为新Doctype
frappe.query_reports["Balance Sheet CN"]["filters"].push({
	fieldname: "balance_sheet_template",
	label: __("Template"),
	fieldtype: "Link",
	options: "Balance Sheet Config CN",  // 关联新配置Doctype
	description: __("Select template to apply account-reporting item mapping and sorting"),
	get_query: function() {
		return {
			filters: {
				company: frappe.query_report.get_filter_value("company")
			}
		};
	},
	on_change: function(query_report) {
		query_report.refresh();
	}
});